package com.hch.service;

import com.hch.dao.UserRepository;
import com.hch.domain.User;
import com.hch.utils.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service    //我吐了
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepository userRepository;

    /**
     *
     * @param username
     * @param password 使用MD5对密码进行加密，避免明文传输密码
     * @return
     */

    @Override
    public User checkUser(String username, String password) {
        User user = userRepository.findByUsernameAndPassword(username, MD5Utils.code(password));
        return user;
    }
}
